from typing import Any
from starlette.responses import JSONResponse


# 返回函数
def ResponseMessage(code: bool, data: Any, status_code: int = 200) -> JSONResponse:
    response_data = {"code": 0, "data": data}
    if code:
        response_data.update(data=data)
    else:
        response_data.update(code=100, data=data)

    return JSONResponse(content=response_data, status_code=status_code)